package org.jeecg.common.constant;

import org.jeecg.common.util.MkEmpty;

import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.Collectors;

import static cn.hutool.core.text.StrPool.COLON;

/**
 * @author: huangxutao
 * @date: 2019-06-14
 * @description: 缓存常量
 */
public interface CacheConstant {

    /**
     * 字典信息缓存（含禁用的字典项）
     */
    public static final String SYS_DICT_CACHE = "sys:cache:dict";

    /**
     * 字典信息缓存 status为有效的
     */
    public static final String SYS_ENABLE_DICT_CACHE = "sys:cache:dictEnable";
    /**
     * 表字典信息缓存
     */
    public static final String SYS_DICT_TABLE_CACHE = "sys:cache:dictTable";
    public static final String SYS_DICT_TABLE_BY_KEYS_CACHE = SYS_DICT_TABLE_CACHE + "ByKeys";

    /**
     * 数据权限配置缓存
     */
    public static final String SYS_DATA_PERMISSIONS_CACHE = "sys:cache:permission:datarules";

    /**
     * 缓存用户信息
     */
    public static final String SYS_USERS_CACHE = "sys:cache:user";
    /**
     * 缓存用户的所属分站信息
     */
    public static final String SYS_USERS_SITE_CACHE = "sys:cache:user:site";
    /**
     * 缓存用户的所属分站信息
     */
    public static final String SYS_USERS_SITE_AREA_CACHE = "sys:cache:user:site:area";
    /**
     * 缓存用户的商家信息
     */
    public static final String SYS_USERS_MERCHENT_CACHE = "sys:cache:user:merchent";
    /**
     * 系统中所有的分站信息
     */
    public static final String SYS_ALL_SITE_CACHE = "sys:cache:all:site";
    /**
     * 缓存用户的商家信息
     */
    public static final String SYS_USERS_MERCHENT_SHOP_CACHE = "sys:cache:user:merchent:shop";

    /**
     * 全部部门信息缓存
     */
    public static final String SYS_DEPARTS_CACHE = "sys:cache:depart:alldata";


    /**
     * 全部部门ids缓存
     */
    public static final String SYS_DEPART_IDS_CACHE = "sys:cache:depart:allids";


    /**
     * 测试缓存key
     */
    public static final String TEST_DEMO_CACHE = "test:demo";

    /**
     * 字典信息缓存
     */
    public static final String SYS_DYNAMICDB_CACHE = "sys:cache:dbconnect:dynamic:";

    /**
     * gateway路由缓存
     */
    public static final String GATEWAY_ROUTES = "sys:cache:cloud:gateway_routes";


    /**
     * gateway路由 reload key
     */
    public static final String ROUTE_JVM_RELOAD_TOPIC = "gateway_jvm_route_reload_topic";


    /**
     * online列表页配置信息缓存key
     */
    public static final String ONLINE_LIST = "sys:cache:online:list";

    /**
     * online表单页配置信息缓存key
     */
    public static final String ONLINE_FORM = "sys:cache:online:form";

    /**
     * online报表
     */
    public static final String ONLINE_RP = "sys:cache:online:rp";

    /**
     * online图表
     */
    public static final String ONLINE_GRAPH = "sys:cache:online:graph";

    /**
     * 协议信息缓存
     */
    String PROTOCOL_INFO = "mk:cache:protocol:info";

    /**
     * 微信小程序AccessToken缓存
     */
    String WECHAT_APPLET_ACCESS_TOKEN = "wx:cache::accessToken";

    /**
     * 商品信息（商品基础 + 商品规格 + 商品属性）列表 by 商品分类id
     */
    String GOODS_LIST_BY_CATEGORIES_ID = "mk:cache:goods:categoriesId";

    /**
     * 商品基础信息
     */
    String GOODS_BASE_INFO = "mk:cache:goodsBase:info";

    /**
     * 商品基础信息列表 by 商品分类id
     */
    String GOODS_BASE_LIST_BY_CATEGORIES_ID = "mk:cache:goodsBase:categoriesId";

    /**
     * 商品属性信息
     */
    String GOODS_ATTR_INFO = "mk:cache:goodsAttribute:info";

    /**
     * 商品属性列表 by 商品id
     */
    String GOODS_ATTR_LIST_BY_GOODS_ID = "mk:cache:goodsAttribute:goodsId";

    /**
     * 商品规格信息
     */
    String GOODS_SPEC_INFO = "mk:cache:goodsSpecifications:info";

    /**
     * 商品规格列表 by 商品id
     */
    String GOODS_SPEC_LIST_BY_GOODS_ID = "mk:cache:goodsSpecifications:goodsId";

    /**
     * 商品分类信息
     */
    String GOODS_CATEGORIES_INFO = "mk:cache:goodsCategories:info";

    /**
     * 商品分类列表 by 店铺id
     */
    String GOODS_CATEGORIES_LIST_BY_SHOP_ID = "mk:cache:goodsCategories:shopId";

    /**
     * 商品历史信息
     */
    String GOODS_HIS_INFO = "mk:cache:goodsHis:info";

    /**
     * 系统中所有的分站区域简略信息
     */
    public static final String SYS_ALL_SITE_AREA_CACHE = "sys:cache:all:siteArea";

    /**
     * 首页统计缓存
     */
    public static final String ORDER_COUNT_PAGE = "mk:cache:order:count";

    /**
     * 购物车缓存
     */
    String SHOPPING_CART_LIST = "mk:cache:shoppingCart:list";

    /**
     * 推送消息模版缓存
     */
    String PUSH_MESSAGE_TEMPLATE_INFO = "mk:cache:pushMessage:info";

    /**
     * 推送消息模版List缓存
     */
    String PUSH_MESSAGE_TEMPLATE_LIST = "mk:cache:pushMessage";

    /**
     * 店铺加价配置
     */
    String SHOP_FARE_CONFIG = "shop:config:fare";

    /**
     * 店铺餐号
     */
    String SHOP_MEAL_NUMBER = "mealNumber:shop";

    /**
     * 订单餐号
     */
    String ORDER_MEAL_NUMBER = "mealNumber:order";

    /**
     * 店铺分类信息
     */
    String SHOP_TYPE_INFO = "shop:shopType:info";

    /**
     * 全部店铺分类信息
     */
    String SHOP_TYPE_ALL = "shop:shopType:all";

    /**
     * 同一父类id下的店铺分类集合
     */
    String SHOP_TYPE_LIST_BY_PARENT_ID = "shop:shopType:parentId";

    /**
     * 提现集下的提现行集合缓存
     */
    String FINANCE_LINE_LIST_BY_GROUP_ID = "finance:line:groupId";
    /**
     * 频道下商品缓存
     */
    String GOODS_CHANNEL_MAP = "nmk:cache:channel:goods";
    /**
     * 空对象
     */
    String CACHE_EMPTY_STR = "EMPTY";
    /**
     * 营销系统中的客户积分缓存
     */
    String YX_CACHE_MEMBER_POINT_STATEMENT = "yx:cache:member:pointStatement";
    /**
     * 常用存活时间2小时
     */
    long COMM_ALIVE_TIME = 60 * 60 * 2;
    /**
     * 积分变动消费获得
     */
    String POINT_MODIFY_TYPE_EXPEND = "2";

    /**
     * 积分变动退款失去
     */
    String POINT_MODIFY_TYPE_REFUND = "7";
    /**
     * 积分变动其他
     */
    String POINT_MODIFY_TYPE_OTHER="0";
    /**
     * 构建redis文件夹与key
     */
    static String build(Serializable... params) {
        return Arrays.stream(params).map(String::valueOf).collect(Collectors.joining(COLON));
    }

}
